//
//  LFBaseViewController.swift
//  SDAutoWeibo
//
//  Created by 刘健 on 16/3/21.
//  Copyright © 2016年 Clemmie. All rights reserved.
//

import UIKit

class LFBaseViewController: UITableViewController,LFVisitViewDelegate {
    
    var isTurn = LFGlobalUserAccountsViewModel.sharedUserAccounts.userLogin
    
    override func loadView() {
        
        isTurn ? super.loadView() : setUpvisitView()
    }
    
    func setUpvisitView() {
        
        view = visitView
        
        visitView.delegate = self
        
        if self is LFHomeTableViewController {
            visitView.iconViewTurnAround()
        }else if self is LFDiscoverTableViewController {
            visitView.changeImageAndLabel("visitordiscover_image_message", labelText: "登录后，最新、最热微博尽在掌握，不再会与实事潮流擦肩而过")
        }else if self is LFMessageTableViewController {
            visitView.changeImageAndLabel("visitordiscover_image_message", labelText: "登录后，别人评论你的微博，发给你的消息，都会在这里收到通知")
        }else {
            visitView.changeImageAndLabel("visitordiscover_image_profile", labelText: "登录后，你的微博、相册、个人资料会显示在这里，展示给别人")
            
        }
        
        //增加导航栏按钮
        navigationItem.leftBarButtonItem = UIBarButtonItem(title:"注册", style: UIBarButtonItemStyle.Plain, target: self, action: "didClickRegister")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "didClickLogin")
       
        
    }
    
      //MARK : -- 实现LFVisitView 代理方法
    //点击注册
    func didClickRegister() {
        
    }
    
    //点击登录
    func didClickLogin() {
        
        let oauth = LFOauthViewController()
     
        presentViewController(LFNavViewController(rootViewController:oauth), animated: true, completion: nil)
    }
    

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
       //MARK : -- 懒加载
    let visitView = LFVisitView()
  
}
